import {createApp} from 'vue'
import SDialog from './dialog.jsx'

export function showDialog(options = {}) {
    return new Promise((resolve, reject) => {
        const container = document.createElement('div')
        document.body.appendChild(container)
        const app = createApp(SDialog, {
            ...options,
            visible: true,
            close() {
                app.unmount()
                document.body.removeChild(container)
            }
        })
        app.mount(container)
    })
}
